<template>
  <el-dialog title="编辑经纪" :visible="isShowWrite" @close="btnCancel">
    <el-form ref="addWrite" label-width="120px" :model="formData" :rules="rules">
      <el-form-item label="名称" prop="name">
        <el-input v-model="formData.name" style="width:90%" placeholder="请输入名称" />
      </el-form-item>
      <el-form-item label="邮箱" prop="email">
        <el-input v-model="formData.email" style="width:90%" placeholder="请输入邮箱" />
      </el-form-item>
      <el-form-item label="电话" prop="phone">
        <el-input v-model="formData.phone" style="width:90%" placeholder="请输入电话" />
      </el-form-item>
      <el-form-item label="地址" prop="address">
        <el-input v-model="formData.address" style="width:90%" placeholder="请输入地址" />
      </el-form-item>
      <el-form-item label="描述" prop="desc">
        <el-input style="width:90%" placeholder="请输入描述" />
      </el-form-item>
      <el-form-item label="封面" prop="image" />
    </el-form>
    <template #footer>
      <el-button size="small" type="primary" @click="btnOK">确定</el-button>
      <el-button size="small" @click="btnCancel">取消</el-button>
    </template>
  </el-dialog>
</template>

<script>
import { getAgentsList } from '@/api/economics'
export default {
  props: {
    isShowWrite: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      formData: {
        name: '',
        email: '',
        phone: '',
        address: '',
        desc: '',
        image: ''
      },
      rules: {
        name: [{ required: true, message: '名称不能为空', trigger: 'blur' },
          { min: 1, max: 4, message: '用户姓名为1-4位' }],
        phone: [{ required: true, message: '电话号码不能为空', trigger: 'blur' },
          { pattern: /^1[3-9]\d{9}$/, message: '电话号码格式不正确', trigger: 'blur' }],
        address: [{ required: true, message: '地址不能为空', trigger: 'blur' }],
        desc: [{ required: true, message: '描述不能为空', trigger: 'blur' }
        //   { validator: onceWorkNumber, trigger: 'blur' }
        ],
        email: [{ required: true, message: '邮箱不能为空', trigger: 'blur' }]

      }
    }
  },
  created() {
    this.getAgentsList()
  },
  methods: {
    async getAgentsList() {
      this.formData = await getAgentsList()
    },
    btnOK() {},
    btnCancel() {}
  }
}
</script>

<style>

</style>
